package xyz.xmh.pattern.creational.singletonpattern;

/**
 * HungrySingleton
 * 饿汉单例
 *
 * @author xuMingHai
 * @since 2021/4/27 星期二 17:37
 */
public class HungrySingleton {
    /**
     * 创建一个私有化的自身实例对象
     */
    private static final HungrySingleton INSTANCE = new HungrySingleton();

    /**
     * 私有化构造函数
     */
    private HungrySingleton() {
    }

    /**
     * 返回自身实例对象
     *
     * @return 实例对象
     */
    public static HungrySingleton getInstance() {
        return INSTANCE;
    }

    public void showMessage() {
        System.out.println("Hello HungrySingleton!");
    }


}
